﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ObTookit.HighLight
{
    public class JsHighLight : BaseHighLight
    {
        private void SetWords()
        {
            DefaultColor = Color.Black;
            Keywords = new string[] { "break", "case", "catch", "continue", "default", "delete", "do", "else", "finally", "for", "function", "if", "in", "instanceof", "new", "return", "switch", "this", "throw", "try", "typeof", "var", "void", "while", "with" };
            KeywordColor = Color.Blue;

            Functions = new string[] { "abstract", "boolean", "byte", "char", "class", "const", "debugger", "double", "enum", "export", "extends", "final", "float", "goto", "implements", "import", "int", "interface", "long", "native", "package", "private", "protected", "public", "short", "static", "super", "synchronized", "throws", "transient", "volatile" };
            FunctionColor = Color.Red;
        }
        public void SetWordsColor(System.Windows.Forms.RichTextBox rtb, string rtbText)
        {
            SetWords();
            rtb.SelectAll();
            rtb.SelectionColor = Color.Black;
            string text = rtb.Text;
            SetHighLight(rtb, text, Keywords, KeywordColor);
            SetHighLight(rtb, text, Functions, FunctionColor);
        }
    }
}
